package huoye.shops.huoye.home.presenter;


import com.codeideology.android.lang.entity.Paging;

import java.util.List;

import huoye.shops.base.BasePresenter;
import huoye.shops.base.MineBaseJsonRequestCallback;
import huoye.shops.huoye.home.model.MerchantCenter;
import huoye.shops.huoye.home.networt.HomeService;
import huoye.shops.huoye.home.view.IHomeDataShowView;
import huoye.shops.huoye.home.view.IHomeView;
import huoye.shops.huoye.operation.model.ShopPrizeList;


/**
 * Created by uesr on 2017/7/19.
 */

public class HomeDataShowPresenter extends BasePresenter<IHomeDataShowView> {


    private HomeService mService;

    //商家管理后台主页
    public void postMerchantCenter(String type){
        // view.showProcessingIndicator();
        mService.postMerchantCenter(type, new MineBaseJsonRequestCallback<MerchantCenter>(MerchantCenter.class) {


            @Override
            public void onSuccess(MerchantCenter merchantCenter) {
                super.onSuccess(merchantCenter);
                view.setData(merchantCenter);

            }

            //网络请求失败
            @Override
            public void onFailure(String msg, String code, Throwable e) {
                super.onFailure(msg, code, e);
                view.makeToast(msg);
            }

            //加载结束
            @Override
            public void onNetworkFail() {
                super.onNetworkFail();
                view.onNetworkFail();
            }

            //加载中
            @Override
            public void onFinish() {
                super.onFinish();
                view.hideProcessingIndicator();
            }
        });
    }


    @Override
    public void onStart() {
        mService = new HomeService();
    }
}
